<?
	include("includes/config.php");
	include("includes/login.php");
	include("includes/functions.php");
	$id_utilizator = $_SESSION['id_utilizator'];
	if(@$_POST['update']){
		$id_unitate = $_POST['id_unitate'];
		$nume_firma = $_POST['nume_firma'];
		$nr_ord_rc = $_POST['nr_ord_rc'];
		$cod_fiscal = $_POST['cod_fiscal'];
		$sediu = $_POST['sediu'];
		$capital_social = $_POST['capital_social'];
		$banca = $_POST['banca'];
		$cont = $_POST['cont'];
		$serie = $_POST['serie'];
		$nr_fact = $_POST['nr_fact'];
		$val_tva = $_POST['val_tva'];
		$serie_comanda = $_POST['serie_comanda'];
		mysql_query("update setari_unitate set 
			nume_firma = '$nume_firma', 
			nr_ord_rc = '$nr_ord_rc', 
			cod_fiscal = '$cod_fiscal',
			sediu = '$sediu', 
			capital_social = '$capital_social', 
			banca = '$banca', 
			cont = '$cont',
			serie_factura = '$serie',
			numar_factura = '$nr_fact', 
			valoaretva = '$val_tva',
			serie_comanda = '$serie_comanda' 
		where id_unitate = '$id_unitate'
		")or die(mysql_error());
	}
?>
<html>
	<head>
		<link rel="stylesheet" type="text/css" href="css/style.css" />
	</head>
	<body>
		<div id="header"><h1> <? echo detaliFirma('nume_firma'); ?></h1></div>
		<div id="warper">
			<?
				$resMeniu = mysql_query("select * from meniu");
			?>
			<div id="menu">
				<ul>
					<? while($rowMen = mysql_fetch_array($resMeniu)): ?>
					<li><a href="<?echo $rowMen['link'];?>"><? echo $rowMen['numeLink']; ?></a></li>
					<? endwhile; ?>
				</ul>
			</div>
			<div id="content">
				<div id="contentWrap">
					<div class="block">
						<a  class="buton" href="/settings.php">Setari Unitate</a>&nbsp; 
						<a class="buton" href="/punctlucru.php">Setari puncte lucru</a>
							<a class="buton" href="/preturi.php">Setari preturi</a>
					</div>
					<div class="block">
						<?
							$res = mysql_query("select * from setari_unitate where id_utilizator = '$id_utilizator' ");
							$row = mysql_fetch_array($res);
						?>
						<form action="" method="post">
							<input type="hidden" value="<? echo $row['id_unitate']; ?>" name="id_unitate">
							<p>
								<label>Nume Firma</label>
								<input type="text" class="text" value="<? echo $row['nume_firma']; ?>" name="nume_firma">
							</p>
							<p>
								<label>Nr.Ord.Rc</label>
								<input type="text" class="text" value="<? echo $row['nr_ord_rc']; ?>" name="nr_ord_rc">
							</p>
							<p>
								<label>Cod Fiscal</label>
								<input type="text" class="text" value="<? echo $row['cod_fiscal']; ?>" name="cod_fiscal">
							</p>
							<p>
								<label>Sediu</label>
								<input type="text" class="text" value="<? echo $row['sediu']; ?>" name="sediu">
							</p>
							<p>
								<label>Capital social <small>(Ron)</small></label>
								<input type="text" class="text" value="<? echo $row['capital_social']; ?>" name="capital_social">
							</p>
							<p>
								<label>Banca</label>
								<input type="text" class="text" value="<? echo $row['banca']; ?>" name="banca">
							</p>
							<p>
								<label>Cont</label>
								<input type="text" class="text" value="<? echo $row['cont']; ?>" name="cont">
							</p>
							<p>
								<label>Serie Factura</label>
								<input type="text" class="text" value="<? echo $row['serie_factura']; ?>" name="serie">
							</p>
							<p>
								<label>Nr. Factura</label>
								<input type="text" class="text" value="<? echo $row['numar_factura']; ?>" name="nr_fact">
							</p>
							<p>
								<label>Valoare Tva <small>(%)</small></label>
								<input type="text" class="text" value="<? echo $row['valoaretva']; ?>" name="val_tva">
							</p>
							<p>
								<label>Serie Comanda </label>
								<input type="text" class="text" value="<? echo $row['serie_comanda']; ?>" name="serie_comanda">
							</p>
							<input class="buton" type="submit" value="Modifica Date" name="update">
							
						</form>
					</div>
				</div>
			
			</div>
		</div>
	</body>
</html>